from iClouds.allSerializers import *

# Create your views here.
class HelloWorld(viewsets.ModelViewSet):
    __title__ = "测试接口"
    __group__ = "管理员模板"
    __info__ = {"get": "测试接口", "post": "测试接口", "patch": "编辑", "delete": "移除"}
    __doc__ = """	list:
    <h4>列表</h4>
    retrieve:
    <h4>详情</h4>
    create:
    <h4>注册员工</h4>
        ?version=1
    partial_update:
    <h4>编辑</h4>
    delete:
    <h4>移除</h4>"""
    http_method_names = ["get"]
    authentication_classes = []
    permission_classes = [AllPermissions]
    versioning_class = MyDefaultVersioning
    serializer_class = NoneSerializer
    queryset = None

    # filter_backends = [ListDjangoFilterBackend]
    # filterset_class = CallmeListFilterSet
    # filterset_fields = ["status"]
    # search_fields = ['phone','email']

    pagination_class = StandardPagination

    def get_serializer_class(self):
        # if self.request and self.request.version == '1':
        #     return NewStaffUserbaseListSerializer
        return NoneSerializer

    def list(self, request, *args, **kwargs):
        # queryset = self.filter_queryset(self.get_queryset())
        # c = queryset.count()
        # page = self.paginate_queryset(queryset)
        # serializer = self.get_serializer(page, many=True)
        # return Response(
        #     {
        #         "rescode": 200,
        #         "resmsg": serializer.data,
        #         "count": c,
        #         "size": self.pagination_class.page_size,
        #     }
        # )
        return Response({"rescode": 200, "resmsg": "HelloWorld"})

    def retrieve(self, request, *args, **kwargs):
        # instance = self.get_object()
        # serializer = self.get_serializer(instance)
        # return Response({"rescode": 200, "resmsg": serializer.data})
        return Response({"rescode": 200, "resmsg": "HelloWorld"})
